package br.mikhas.task.metadata;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;

import br.mikhas.task.TaskList;

public class HolidayCalendar {

	protected long number;

	/**
	 * Calendar name
	 */
	protected String name;
	/**
	 * Task list this calendar belongs
	 */
	protected TaskList list;
	/**
	 * Holidays
	 */
	protected Collection<Holiday> holidays;

	public TaskList getList() {
		return list;
	}

	public void setList(TaskList list) {
		this.list = list;
	}

	public void addHoliday(Holiday holiday) {
		if (this.holidays == null) {
			this.holidays = new HashSet<Holiday>();
		}
		this.holidays.add(holiday);
	}

	public Collection<Holiday> getHolidays() {
		return Collections.unmodifiableCollection(this.holidays);
	}

	public boolean isHoliday(Holiday holiday) {
		if (this.holidays == null || this.holidays.isEmpty())
			return false;
		return this.holidays.contains(holiday);
	}

}
